package com.curtain.koreyoshi.view.widget;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

/**
 * Created by leejunpeng on 2016/4/9.
 */
public class PointView extends View {

    private final  Paint paint;
    private final Context context;


    private int ringColor = 0x33ffffff;


    public void setRingColor(int ringColor) {
        this.ringColor = ringColor;
        invalidate();
    }

    public void setRingRadius(int ringRadius) {
        this.ringRadius = ringRadius;
        invalidate();
    }

    private int ringRadius;

    public PointView(Context context) {

        // TODO Auto-generated constructor stub
        this(context, null);
    }

    public PointView(Context context, AttributeSet attrs) {
        super(context, attrs);
        // TODO Auto-generated constructor stub
        this.context = context;
        this.paint = new Paint();
        this.paint.setAntiAlias(true); //消除锯齿
        this.paint.setStyle(Paint.Style.FILL); //绘制空心圆
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        // TODO Auto-generated method stub
        int center = getWidth()/2;
        int centerY = ringRadius;
        //绘制内圆
        this.paint.setColor(ringColor);
        canvas.drawCircle(center,centerY, ringRadius, this.paint);

    }

}
